package com.tanhua.model.vo;

import com.tanhua.model.db.UserInfo;
import com.tanhua.model.mongo.RecommendUser;
import com.tanhua.model.mongo.UserLike;
import com.tanhua.model.mongo.Visitors;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserLikeListVo implements Serializable {

    private Long id;
    private String avatar;
    private String nickname;
    private String gender;
    private Integer age;
    private String city;
    private String education;
    private boolean alreadyLove;
    private Integer marriage; //婚姻状态（0未婚，1已婚）
    private Integer matchRate; //匹配度 (缘分值)


    public static UserLikeListVo init(UserInfo info, Visitors item) {
        UserLikeListVo vo = new UserLikeListVo();
        BeanUtils.copyProperties(info,vo);
        vo.setMatchRate(item.getScore().intValue());
        vo.setAlreadyLove(false);
        return vo;
    }

    public static UserLikeListVo init(UserInfo info, RecommendUser item) {
        UserLikeListVo vo = new UserLikeListVo();
        BeanUtils.copyProperties(info,vo);
        vo.setMatchRate(item.getScore().intValue());
        vo.setAlreadyLove(false);
        return vo;
    }

    public static UserLikeListVo init(UserInfo info,UserLike item) {
        UserLikeListVo vo = new UserLikeListVo();
        BeanUtils.copyProperties(info,vo);
        return vo;
    }
}